home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-2.iso / extra_2 / nadir11.zip / INV.N < prev    next >
Text File  |  1995-11-08  |  21KB  |  553 lines

  1. If(0)
  2.  
  3.     DATA STORED IN INVOICE FILE
  4.  
  5.     code is invoice number
  6.  
  7.     inv^[code]^date = invoice date
  8.     ..........^job  = job number
  9.     ..........^clnt = client code
  10.     ..........^brch = branch code
  11.     ..........^vamt = valuation amount
  12.     ..........^vtyp = valuation type
  13.     ..........^ptyp = property type
  14.     ..........^appl = applicant name
  15.     ..........^loan = loan account number
  16.     ..........^add1 = address text
  17.     ..........^add2
  18.     ..........^add3
  19.     ..........^add4
  20.     ..........^aiv  = scheduled fee (aust inst valuers)
  21.     ..........^base = base valuation amount
  22.     ..........^extr = extras amount
  23.     ..........^feet = fee text
  24.  
  25.     invnum^new      = The next invoice number to automatically allocate.
  26.  
  27.     The keys that are defined. Code assumes all keys start with inv_
  28.  
  29.     inv_clbr^[clnt]^[brch]^[date]^[code]            = "y"
  30.  
  31.     inv_mecb^[MonthEnd(date)]^[clnt]^[brch]^[code]  = "y"
  32.  
  33.     inv_mecl^[MonthEnd(date)]^[clnt]^[code]         = "y"
  34.  
  35.     inv_date^[date]^[code]                          = "y"
  36.  
  37.     inv_job^[job]^[code]                            = "y"
  38.  
  39.     inv_ptyp^[ptyp]^[clnt]^[code]                   = "y"
  40.  
  41.     inv_vtyp^[vtyp]^[clnt]^[code]                   = "y"
  42.  
  43. Endif
  44. If(0)
  45.     Following Eval will setup default valuation and property types and 
  46.     invoice printer definitions in univ
  47. Endif
  48. Eval {
  49.     univ^vtyp_code^mv  = "Mortgage Valuation";
  50.     univ^vtyp_code^nmv = "Non Mortgage Valuation";
  51.     univ^vtyp_code^pi  = "Progress Inspections";
  52.  
  53.     univ^ptyp_code^d   = "Domestic Premises";
  54.     univ^ptyp_code^ft  = "Flats and Townhouses";
  55.     univ^ptyp_code^cp1 = "Commercial Premises to $5,000,000";
  56.     univ^ptyp_code^cp2 = "Commercial Premises above $5,000,000";
  57.     univ^ptyp_code^gvt = "Government and Semi Govt Properties";
  58.     univ^ptyp_code^ip1 = "Industrial Premises to $5,000,000";
  59.     univ^ptyp_code^ip2 = "Industrial Premises above $5,000,000";
  60.     univ^ptyp_code^lp  = "Licenced Premises";
  61.     univ^ptyp_code^m   = "Motels";
  62.     univ^ptyp_code^hr  = "Holiday Resorts over $2,000,000";
  63.     univ^ptyp_code^ca  = "Caravan Parks (under $2,000,000)";
  64.     univ^ptyp_code^sr  = "Semi-rural";
  65.     univ^ptyp_code^ra  = "Rental Assessment";
  66.     univ^ptyp_code^or  = "Other";
  67.  
  68.     parm^prt^inv^name   = "";
  69.     parm^prt^inv^copies = 1;
  70.     parm^prt^inv^append = "";
  71.     parm^prt^inv^browse = "b";
  72.     parm^page^inv^height = 66;
  73.     parm^page^inv^width  = 80;
  74.     parm^page^inv^margin^top    = 3;
  75.     parm^page^inv^margin^bottom = 3;
  76.     parm^page^inv^margin^left   = 0;
  77.     parm^page^inv^margin^right  = 0;
  78. }
  79. Define InvSearchCode(key, type) {
  80.     Explode(key, "^", &code);
  81.     if (type != "s")
  82.         return code;
  83.     return code. "\t". data^inv_code^[code];
  84. }
  85. Define InvSearchClient(key, type)   {
  86.     Explode(key, "^", &code);
  87.     if (type != "s")
  88.         return code;
  89.     return code. "\t". univ^clnt_code^[code];
  90. }
  91. Define InvSearchBranch(key, type)   {
  92.     Explode(key, "^", &code);
  93.     if (type != "s")
  94.         return code;
  95.     return code. "\t". univ^clbr_code^[code];
  96. }
  97. Define InvSearchPtyp(key, type) {
  98.     Explode(key, "^", &code);
  99.     if (type != "s")
  100.         return code;
  101.     return code. "\t". univ^ptyp_code^[code];
  102. }
  103. Define InvSearchVtyp(key, type) {
  104.     Explode(key, "^", &code);
  105.     if (type != "s")
  106.         return code;
  107.     return code. "\t". univ^vtyp_code^[code];
  108. }
  109. Define InvSearchAlt(key, type) {
  110.     Explode(key, "^", &alt, &code);
  111.     if (type != "s")
  112.         return alt;
  113.     return alt. "\t". code. "\t". data^inv_code^[code];
  114. }
  115. Define InvSearchAltClbr(key, type) {
  116.     Explode(key, "^", &client, &branch, &date, &code);
  117.     alt = client. "^". branch;
  118.     if (type != "s")
  119.         return alt;
  120.     return alt. "\t". code. "\t". data^inv_code^[code];
  121. }
  122. Define InvSearch(invCode) {
  123.     code = invCode;
  124.     scr = SdCreate(, -2, -2, 12, 68, "Invoice Search");
  125.  
  126.     SdPrompt(scr, 1,  3, "Invoice No      :");
  127.     SdCombo(scr, "code",  1,  1, 21, 10, 10, "", "data^inv_code^", 133, 
  128.                                            "InvSearchCode", 70, , 139);
  129.     SdFieldCols(scr, "code", 8);
  130.     SdPrompt(scr, 3,  3, "Client^Branch   :");
  131.     SdCombo(scr, "clbr",  1,  3, 21, 21, 10, "", "data^inv_clbr^", 134, 
  132.                                             "InvSearchAltClbr", 70, , 139);
  133.     SdFieldCols(scr, "clbr", 18, 8);
  134.     SdPrompt(scr, 4,  3, "Date            :");
  135.     SdCombo(scr, "date",  1,  4, 21, 14, 10, "", "data^inv_date^",  135, 
  136.                                             "InvSearchAlt", 70, , 139);
  137.     SdFieldCols(scr, "date", 12, 8);
  138.     SdPrompt(scr, 5,  3, "Job No          :");
  139.     SdCombo(scr, "job",   1,  5, 21, 10, 10, "", "data^inv_job^",  136, 
  140.                                            "InvSearchAlt", 70, , 139);
  141.     SdFieldCols(scr, "job", 8, 8);
  142.     SdPrompt(scr, 6,  3, "Valuation Type  :");
  143.     SdCombo(scr, "vtyp",  1,  6, 21, 12, 10, "", "data^inv_vtyp^", 137, 
  144.                                            "InvSearchAlt", 70, , 139);
  145.     SdFieldCols(scr, "vtyp", 8, 8);
  146.     SdPrompt(scr, 7,  3, "Property Type   :");
  147.     SdCombo(scr, "ptyp",  1,  7, 21, 12, 10, "", "data^inv_ptyp^", 138, 
  148.                                            "InvSearchAlt", 70, , 139);
  149.     SdFieldCols(scr, "ptyp", 8, 8);
  150.     SdPrompt(scr, 9,  3, "Applicant       :");
  151.     SdString(scr,"appl",  0,  9, 21, 40);
  152.  
  153.     SdButton(scr, "ok",   1, 11, 39, 10, "OK", "", 1);
  154.     SdButton(scr, "can",  1, 11, 52, 10, "Cancel", "", 2);
  155.  
  156.     setFields = "y";
  157.  
  158.     while (1) {
  159.         if (setFields) {
  160.             setFields = "";
  161.  
  162.             SdFieldSet(scr, "code",     code);
  163.             data^inv_code^[code] ?
  164.                 SdFieldSet(scr, "clbr", data^inv^[code]^clnt . "^" .
  165.                                         data^inv^[code]^brch . "^" .
  166.                                         data^inv^[code]^date . "^" . code,
  167.                                 "date", data^inv^[code]^date . "^" . code,
  168.                                 "job",  data^inv^[code]^job . "^" . code,
  169.                                 "vtyp", data^inv^[code]^vtyp . "^" . code,
  170.                                 "ptyp", data^inv^[code]^ptyp . "^" . code,
  171.                                 "appl", data^inv^[code]^appl)
  172.             :
  173.                 SdFieldSet(scr, "clbr", "",
  174.                                 "date", "",
  175.                                 "job",  "",
  176.                                 "vtyp", "",
  177.                                 "ptyp", "",
  178.                                 "appl", "");
  179.         }
  180.         cmd = SdEdit(scr, cursor);
  181.         code = SdFieldGet(scr, "code");
  182.         switch (cmd) {
  183.         case 133:                   /* code combo box */
  184.             cursor = "code";
  185.             setFields = "y";
  186.             continue;
  187.  
  188.         case 134:                   /* client branch combo */
  189.             cursor = "clbr";
  190.             Explode(SdFieldGet(scr, cursor), "^", "", "", "", &code);
  191.             setFields = "y";
  192.             continue;
  193.  
  194.         case 135:                   /* data combo */
  195.             cursor = "date";
  196.             goto GETCODE;
  197.         case 136:
  198.             cursor = "job";
  199.             goto GETCODE;
  200.         case 137:
  201.             cursor = "vtyp";
  202.             goto GETCODE;
  203.         case 138:
  204.             cursor = "ptyp";
  205.         GETCODE:
  206.             Explode(SdFieldGet(scr, cursor), "^", "", &code);
  207.             setFields = "y";
  208.             continue;
  209.  
  210.         case 1:                         /* Enter button or key */
  211.         case 139:                       /* Double clicked any combo */
  212.             if (SdFieldMod(scr) > 0 &&
  213.                 !(SdFieldMod(scr) == 1 && SdFieldMod(scr, "code"))) {
  214.                 /*
  215.                     the text of a field was modified, and it wasnt just
  216.                     the code field
  217.                 */
  218.                 MsgWait(, "You must select using a Combo Box");
  219.                 if (SdFieldMod(scr, "clbr"))
  220.                     cursor = "clbr";
  221.                 else if (SdFieldMod(scr, "date"))
  222.                     cursor = "date";
  223.                 else if (SdFieldMod(scr, "job"))
  224.                     cursor = "job";
  225.                 else if (SdFieldMod(scr, "ptyp"))
  226.                     cursor = "ptyp";
  227.                 else if (SdFieldMod(scr, "vtyp"))
  228.                     cursor = "vtyp";
  229.                 else
  230.                     cursor = "code";
  231.                 continue;
  232.             }
  233.             if (!data^inv_code^[code]) {
  234.                 MsgWait(, "Invalid Invoice No");
  235.                 cursor = "code";
  236.                 continue;
  237.             }
  238.             invCode = code;         /* set invoice no we are returning */
  239.         }
  240.         break;
  241.     }
  242.     SdDestroy(scr);
  243.  
  244.     return cmd;
  245. }
  246. Define InvPrepScr() {
  247.     scr = SdCreate(, -1, -1, 22, 76, "Invoice Preparation");
  248.  
  249.     SdPrompt(scr, 1,  2, "Invoice No      :");
  250.     SdCombo (scr, "code",  0,  1, 20, 10, 10, "", "data^inv_code^", 
  251.                                             133, "InvSearchCode", 70, , 136);
  252.     SdFieldCols(scr, "code", 8);
  253.     SdButton(scr, "srch", 0,  1, 33, 10, "Search", "s", 134);
  254.     SdPrompt(scr, 3,  2, "Date            :");
  255.     SdDate  (scr,  "date",  0,  3, 20, 10);
  256.     SdPrompt(scr, 3, 46, "Job No        :");
  257.     SdInt   (scr,  "job",   0,  3, 62,  6);
  258.     SdPrompt(scr, 4,  2, "Client          :");
  259.     SdCombo (scr, "clnt",  0,  4, 20, 12, 10, "", "univ^clnt_code^", 135);
  260.     SdPrompt(scr, 4, 46, "Branch        :");
  261.     SdCombo (scr, "brch",  0,  4, 62, 12, 10, "", "univ^clbr_code^^");
  262.  
  263.     SdPrompt(scr, 5,  2, "Valuation Type  :");
  264.     SdCombo (scr, "vtyp",  0,  5, 20, 12, 10, "", "univ^vtyp_code^", 0, 
  265.                                             "InvSearchVtyp", 50);
  266.     SdFieldCols(scr, "vtyp", 8);
  267.     SdPrompt(scr, 5, 46, "Property Type :");
  268.     SdCombo (scr, "ptyp",  0,  5, 62, 12, 10, "", "univ^ptyp_code^", 0, 
  269.                                             "InvSearchPtyp", 50);
  270.     SdFieldCols(scr, "ptyp", 8);
  271.  
  272.     SdPrompt(scr, 7,  2, "Applicant       :");
  273.     SdString(scr,"appl",  0,  7, 20, 40);
  274.  
  275.     SdPrompt(scr, 8,  2, "Loan Account No :");
  276.     SdString(scr,"loan",  0,  8, 20, 20);
  277.  
  278.     SdPrompt(scr,10,  2, "Property Addr   :");
  279.     SdString(scr,"add1", 0, 10, 20, 40);
  280.     SdString(scr,"add2", 0, 11, 20, 40);
  281.     SdString(scr,"add3", 0, 12, 20, 40);
  282.     SdString(scr,"add4", 0, 13, 20, 40);
  283.  
  284.     SdPrompt(scr,15,  2, "Fees -");
  285.     SdPrompt(scr,15,  9, "AIV      :");
  286.     SdFloat (scr,"aiv",   0, 15, 20,  9, "", 2);
  287.     SdPrompt(scr,15, 46, "Valuation Amt :");
  288.     SdInt   (scr,"vamt",  0, 15, 62,  9);
  289.  
  290.     SdPrompt(scr,16,  9, "Base     :");
  291.     SdFloat (scr,"base",  0, 16, 20,  9, "", 2);
  292.     SdPrompt(scr,17,  9, "Extras   :");
  293.     SdFloat (scr,"extr",  0, 17, 20,  9, "", 2);
  294.     SdPrompt(scr,18,  9, "Text     :");
  295.     SdString(scr,"feet",  0, 18, 20, 40);
  296.  
  297.     SdButton(scr, "add",  0, 20,  9, 10, "Add", "a", 1);
  298.     SdButton(scr, "mod",  0, 20, 22, 10, "Modify", "m", 112);
  299.     SdButton(scr, "del",  0, 20, 35, 10, "Delete", "d", 114);
  300.     SdButton(scr, "prt",  0, 20, 48, 10, "Print", "p", 115);
  301.     SdButton(scr, "can",  1, 20, 61, 10, "Cancel", "", 2);
  302.     return scr;
  303. }
  304. Define InvNumCancel(num)
  305. /*
  306.     called if we cancel adding num
  307. */
  308. {
  309.     if (num + 1 == data^invnum^new)
  310.         data^invnum^new = num;
  311. }
  312. Define InvAdd(code) {
  313.     Explode(prev(data^inv_code^[999999999]), "^", "", &auto);
  314.     auto = auto + 1;                    /* auto is the next invoice number */
  315.     if (auto < data^invnum^new)         /* automatically chosen */
  316.         auto = data^invnum^new;
  317.     data^invnum^new = auto + 1;
  318.     num = auto;
  319.  
  320.     scr = SdCreate(, -2, -2,  5, 33, "New Invoice");
  321.     SdPrompt(scr, 1,  4, "Next Invoice No :");
  322.     SdInt   (scr, "code",  1,  1, 22,  6, num);
  323.     SdButton(scr, "ok",   1,  3,  5, 10, "OK", "", 1);
  324.     SdButton(scr, "can",  1,  3, 18, 10, "Cancel", "", 2);
  325.  
  326.     while ((cmd = SdEdit(scr)) == 1) {
  327.         code = SdFieldGet(scr, "code");
  328.         if (code < 0 || code > 999999) {
  329.             MsgWait("", "Invalid Invoice No out of range.");
  330.             continue;
  331.         }
  332.         if (data^inv_code^[code]) {
  333.             MsgWait("", "Invoice No exists already.");
  334.             continue;
  335.         }
  336.         else
  337.             break;
  338.     }
  339.     if (cmd == 2 || cmd == 3 || num != auto)
  340.         InvNumCancel(auto);
  341.  
  342.     SdDestroy(scr);
  343.     return cmd;
  344. }
  345. Define InvKeysSet(code, value) {
  346. /*
  347.     set or delete the keys for invoice with number of code.
  348.     if value is null, keys are deleted, else if "y", keys are set
  349. */
  350.     date = data^inv^[code]^date;
  351.     clnt = data^inv^[code]^clnt;
  352.     brch = data^inv^[code]^brch;
  353.     data^inv_job^[data^inv^[code]^job]^[code] = value;
  354.     data^inv_date^[date]^[code] = value;
  355.     data^inv_clbr^[clnt]^[brch]^[date]^[code] = value;
  356.     data^inv_mecl^[DateMonthEnd(date)]^[clnt]^[date]^[code] = value;
  357.     data^inv_mecb^[DateMonthEnd(date)]^[clnt]^[brch]^[date]^[code] = value;
  358.     data^inv_vtyp^[data^inv^[code]^vtyp]^[code] = value;
  359.     data^inv_ptyp^[data^inv^[code]^ptyp]^[code] = value;
  360. }
  361. Define InvDelete(code) {
  362.     InvKeysSet(code, "");
  363.     while (field = NextField("data", "inv", code, field))
  364.         data^inv^[code]^[field] = "";
  365.     data^inv_code^[code] = "";
  366. }
  367. Define InvPrep() {
  368.     scr = InvPrepScr();
  369.     mode = 1;
  370.     cursor = "";
  371.     while (1) {
  372.         if (!cursor || cursor == "n") {
  373.             if (mode) {
  374.                 SdModeSet(scr, 0);
  375.                 SdModeSet(scr, 1, "code", "srch", "add", "del", "prt", "can");
  376.                 SdButton(scr, "mod",  1, 20, 22, 10, "Modify", "m", 112);
  377.             }
  378.             else {
  379.                 SdModeSet(scr, 1);
  380.                 SdModeSet(scr, 0, "code", "srch", "del", "prt");
  381.                 if (data^inv_code^[code]) {
  382.                     SdModeSet(scr, 0, "add");
  383.                     SdButton(scr, "mod",  1, 20, 22, 10, "Modify", "m", 1);
  384.                     SdCombo(scr, "brch",  1,  4, 62, 12, 10, "", 
  385.                             "univ^clbr_code^". data^inv^[code]^clnt. "^");
  386.                 }
  387.                 else
  388.                     SdModeSet(scr, 0, "mod");
  389.             }
  390.             SdFieldVar(scr, "code",     code,
  391.                             "clnt",     &data^inv^[code]^clnt,
  392.                             "brch",     &data^inv^[code]^brch,
  393.                             "job",      &data^inv^[code]^job,
  394.                             "date",     &data^inv^[code]^date,
  395.                             "vamt",     &data^inv^[code]^vamt,
  396.                             "vtyp",     &data^inv^[code]^vtyp,
  397.                             "ptyp",     &data^inv^[code]^ptyp,
  398.                             "appl",     &data^inv^[code]^appl,
  399.                             "loan",     &data^inv^[code]^loan,
  400.                             "add1",     &data^inv^[code]^add1,
  401.                             "add2",     &data^inv^[code]^add2,
  402.                             "add3",     &data^inv^[code]^add3,
  403.                             "add4",     &data^inv^[code]^add4,
  404.                             "aiv",      &data^inv^[code]^aiv,
  405.                             "base",     &data^inv^[code]^base,
  406.                             "extr",     &data^inv^[code]^extr,
  407.                             "feet",     &data^inv^[code]^feet);
  408.             if (!mode) {
  409.                 if (!SdFieldGet(scr, "date"))
  410.                     SdFieldSet(scr, "date", DateToday());
  411.             }
  412.         }
  413.         cmd = SdEdit(scr, cursor);
  414.         cursor = "";
  415.         if (mode) {
  416.             Explode(SdFieldGet(scr, "code"), "^", &code);
  417.             if (cmd == 133) {           /* action on the combo box */
  418.                 cursor = "n";           /* will reload fields and continue */
  419.                 continue;
  420.             }
  421.             else if (cmd == 134) {
  422.                 InvSearch(&code);
  423.                 continue;
  424.             }
  425.             else if (cmd == 1) {        /* enter or add */
  426.                 if (InvAdd(&code) != 1)
  427.                     continue;
  428.             }
  429.             else if (cmd == 2 || cmd == 3) {    /* cancel or close */
  430.                 break;
  431.             }
  432.             else {
  433.                 if (!data^inv_code^[code]) {
  434.                     MsgWait("", "Invoice No does not exist.");
  435.                     continue;
  436.                 }
  437.                 if (cmd == 114) {   /* delete */
  438.                     if ((cmd = MsgYesNoCancel("", 
  439.                                "Delete " . code . ", are you sure ?")) 
  440.                         && cmd == 2)        /* yes hit ? */
  441.                         InvDelete(code);
  442.                     continue;
  443.                 }
  444.                 else if (cmd == 115) {  /* print */
  445.                     InvPrint(code);
  446.                     continue;
  447.                 }                       /* else its modify and action 136 */
  448.             }
  449.             mode = 0;                   /* means change details */
  450.         }
  451.         else {
  452.             if (cmd == 135) {
  453.                 brch = SdFieldGet(scr, "brch");
  454.                 SdCombo(scr, "brch",  1,  4, 62, 12, 10, 
  455.                         &data^inv^[code]^brch, 
  456.                         "univ^clbr_code^". SdFieldGet(scr, "clnt"). "^");
  457.                 SdFieldSet(scr, "brch", brch);
  458.                 cursor = "next";
  459.                 continue;
  460.             }
  461.             else if (cmd == 1) {
  462.                 if (!(clnt = SdFieldGet(scr, "clnt")) || !univ^clnt_code^[clnt]) {
  463.                     MsgWait("", "Client must be specified and must exist.");
  464.                     cursor = "clnt";
  465.                     continue;
  466.                 }
  467.                 if ((brch = SdFieldGet(scr, "brch")) && !univ^clbr_code^[clnt]^[brch]) {
  468.                     MsgWait("", "Specified Branch does not exist.");
  469.                     cursor = "brch";
  470.                     continue;
  471.                 }
  472.                 if ((ptyp = SdFieldGet(scr, "ptyp")) && !univ^ptyp_code^[ptyp]) {
  473.                     MsgWait("", "Property Type specified does not exist.");
  474.                     cursor = "ptyp";
  475.                     continue;
  476.                 }
  477.                 if ((vtyp = SdFieldGet(scr, "vtyp")) && !univ^vtyp_code^[vtyp]) {
  478.                     MsgWait("", "Valuation Type specified does not exist.");
  479.                     cursor = "vtyp";
  480.                     continue;
  481.                 }
  482.                 InvKeysSet(code, "");
  483.                 SdUpdate(scr);
  484.                 InvKeysSet(code, "y");
  485.                 data^inv_code^[code] = SdFieldGet(scr, "date"). "  ".
  486.                                        SdFieldGet(scr, "clnt"). "  ".
  487.                                        SdFieldGet(scr, "brch"). "  ".
  488.                                        SdFieldGet(scr, "appl");
  489.             }
  490.             else if (cmd == 2 || cmd == 3 || num != auto) {
  491.                 InvNumCancel(code);
  492.                 if (cmd == 3)
  493.                     break;
  494.             }
  495.             mode = 1;                   /* means do next selection */
  496.         }
  497.         cursor = "";
  498.     }
  499.     SdDestroy(scr);
  500. }
  501. Define InvKeyRebuild() {
  502.  
  503.     scr = MsgCreate("Invoice Key Rebuild");
  504.  
  505.     invCode = "inv_";
  506.     while (1) {                         /* remove them all */
  507.         Explode((invCode = next(data^[invCode])), "^", &pre);
  508.         Explode(pre, "_", &p1, &p2);
  509.         if (p1 != "inv")
  510.             break;
  511.         if (p2 == "code")
  512.             continue;
  513.         if (abort = MsgShow(scr, "Deleting " . invCode))
  514.             break;
  515.         data^[invCode] = "";
  516.     }
  517.     if (!abort) {
  518.         code = "";
  519.         while (1) {
  520.             Explode(next(data^inv_code^[code]), "^", &pre, &code);
  521.             if (pre != "inv_code")
  522.                 break;
  523.             if (abort = MsgShow(scr, "Rebuild " . code))
  524.                 break;
  525.  
  526.             InvKeysSet(code, "y");
  527.         }
  528.     }
  529.     MsgDestroy(scr);
  530.  
  531. }
  532. Define InvRemove() {
  533.     if (PeriodStartEndGet("Invoice Removal", &fromDate, &toDate) != 1)
  534.         return;
  535.     if (MsgYesNo("Invoice Removal", "Removing invoices from " .
  536.                                     fromDate . " to " . toDate .
  537.                                     "\n\nAre you sure ?") != 1)
  538.         return;
  539.                                 
  540.     scr = MsgCreate("Invoice Removal");
  541.     date = fromDate;
  542.     code = "";
  543.     while (1) {
  544.         Explode(next(data^inv_date^[date]^[code]), "^", &p1, &date, &code);
  545.         if (p1 != "inv_date" || date > toDate)
  546.             break;
  547.         if (abort = MsgShow(scr, date . " Invoice " . code))
  548.             break;
  549.         InvDelete(code);
  550.     }
  551.     MsgDestroy(scr);
  552. }
  553.